﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace LocalizationTest
{
  class TimeTool
  {
    public static Dictionary<string, TimeSpan> durations = new Dictionary<string,TimeSpan>();

    public static Dictionary<string, DateTime> startTimes = new Dictionary<string,DateTime>();

    public static void Start(string durationID)
    {
      startTimes[durationID] = DateTime.Now;
    }
    public static void Stop(string durationID)
    {
      if (startTimes.ContainsKey(durationID)) durations[durationID] = DateTime.Now - startTimes[durationID];
      else
        System.Windows.Forms.MessageBox.Show("TimeTool: stopID \"" + durationID + "\" does not match any startID");
    }

    public static void Show(System.Windows.Forms.Label label)
    {
      label.Text = "";
      foreach (string key in durations.Keys)
      {
        label.Text += key.ToString() + ": " + durations[key].TotalSeconds + "\n";
      }
    }
  }
}
